import { empPageSelecct } from '@/api/organize'
import { ref } from 'vue'
import { Emp } from './types'

const useSpecifyPersonOptions = () => {
  const getSpecifyPersonOptionsLoading = ref(false)
  const specifyPersonOptions = ref<Array<Emp>>([])

  const getSpecifyPersonOptions = async (keyword: string) => {
    getSpecifyPersonOptionsLoading.value = true
    const res = await empPageSelecct({ limit: 0, name: keyword, page: 0 })
    getSpecifyPersonOptionsLoading.value = false
    specifyPersonOptions.value = res.data.data.rows
  }

  return {
    specifyPersonOptions,
    getSpecifyPersonOptionsLoading,
    getSpecifyPersonOptions,
  }
}

export default useSpecifyPersonOptions
